<?php
header('Content-Type: text/html; charset=utf-8');
include('../class/image_class.php');
if($_FILES)
{
	foreach($_FILES as $files=>$vol)
   	{
   		$name=$files;
   		if($_FILES[$name]['error']==1)
   		{
   			echo '<img alt="Превышен максимальный размер файла!" />';
   			exit;
   		}
       	$image = new SimpleImage();
		$image->load($_FILES[$name]['tmp_name']);
		$img_name='../'.$name.'.jpg';
		$image->resizeToHeight(300);
		$image->save($img_name);
	}
	echo ('
	<img src="'.$name.'.jpg?'.rand().'" />
	<input name="imgName" type="hidden" value="'.$name.'">
	');
}
?>